package com.example.simple.controller;

import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONString;
import cn.hutool.json.JSONUtil;
import com.example.simple.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class TestController {


    @RequestMapping(value = "/testAjax", produces = "application/json;charset=UTF-8")
    public String testAjax(){
        Student student = new Student();
        student.setId(UUID.randomUUID().toString().replaceAll("-",""));
        student.setAge("29");
        student.setName("张三");
        student.setAddress("你是一个坏人，坏人怎么办！");
        JSONObject jsonObject = JSONUtil.parseObj(student);
    return jsonObject.toString();
    }
}
